package com.roger.mybatisplus.demo.controller;

import com.roger.mybatisplus.demo.service.UsersService;
import org.apache.shiro.authc.UnknownAccountException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class LoginController {

    @Autowired
    private UsersService usersService;


    @RequestMapping("/user/login")
    public String login(String username, String password){
        try {
            usersService.userLogin(username, password);
            return "main";
        }catch (UnknownAccountException e){
            return "fail";
        }

    }
}
